<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
<link href="<%=path%>/css/style_min.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/form.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/xWindowPanel.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css" />
<script src="<%=path%>/js/prototype_for_validation.js"
	type="text/javascript"></script>
<script src="<%=path%>/js/validation_cn.js" type="text/javascript"></script>
    <style type="text/css">
    input { width: 180px;}
    textarea { width: 503px; height: 40px;}
    select { width: 188px;}
    .n { text-align: right;}
    </style>
  </head>
  <body>
    <form name="outOrderForm" id="outOrderForm" action="<%=path%>/product/outOrder/update.t4m" class="form" method="post">
    <input type="hidden" name="object.id" value="${object.id}"/> 
    <div class="form-group">销售订单出库修改</div>
         <table class="form-table" cellspacing="0" cellpadding="0">
        <tr>
          <td class="form-left">销售单编号</td>
          <td class="form-right"><input type="text" value="${object.salesOrder.code}" readonly="readonly" class="text"/></td>
          <td class="form-left">发票编号</td>
          <td class="form-right"><input type="text" value="${object.salesOrder.billCode}" readonly="readonly" class="text"/></td>
        </tr>
        <tr>
          <td class="form-left">出库单编号</td>
          <td class="form-right"><input type="text" name="object.code" value="${object.code}" readonly="readonly" class="text required"/></td>
          <td class="form-left">出库日期</td>
          <td class="form-right"><input type="text" name="object.outStockDate" value='<s:date name="object.outStockDate" format="yyyy-MM-dd" />'
           readonly="readonly" onfocus="new WdatePicker({dateFmt:'yyyy-MM-dd'});" class="text required"/></td>
        </tr>
      </table>
   
      <div id="toolbar"></div>
      <table id="titleTable" cellpadding="0" cellspacing="0">
        <tr>
		<td>货品编号</td>
		<td>货品名称</td>
		<td>规格型号</td>
		<td>生产商</td>
		<td>所在仓库</td>
		<td>出库数量</td>
		<td>取消</td>
        </tr>
      </table>
      <table id="dataTable" cellpadding="0" cellspacing="0">
        <s:iterator id="outProduct" value="itemList" status="i">
          <tr class="row" id="<s:property value="#outProduct.product.id"/>">
            <td><span><s:property value="#outProduct.product.code"/></span></td>
            <td><span><s:property value="#outProduct.product.name"/></span></td>
            <td><span><s:property value="#outProduct.product.standard"/></span></td>
            <td><span><s:property value="#outProduct.product.manufacturer"/></span></td>
            <td><span><s:property value="#outProduct.warehouse.name"/></span>
             <input type="hidden" name="outOrderProducts[${i.index}].product.id" value='<s:property value="#outProduct.product.id"/>'/>
            <input type="hidden" name="outOrderProducts[${i.index}].warehouse.id" value='<s:property value="#outProduct.warehouse.id"/>' />
            </td>
         
            <td>
            <span>
            <input type="text" width="8" name="outOrderProducts[${i.index}].amounts"  value="<s:property value="#outProduct.amounts"/>"/>
            </span> <td>
            <div class="quick-button" style="background-position: -39px 0px;" onclick="delData('<s:property value="#outProduct.id"/>')"></div>
            </td>

          </tr>
        </s:iterator>
      </table>
      
      <s:hidden name="tabId"/>
      <s:hidden name="windowPanelId"/>
    </form>
      <script src="<%=path%>/js/core.js" type="text/javascript"></script>
    <script src="<%=path%>/js/share.js" type="text/javascript"></script>
    <script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
    <script src="<%=path%>/js/datePicker/WdatePicker.js" type="text/javascript"></script>
  <script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
    <script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
  <script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
  <script src="<%=path%>/js/modules/stock.js" type="text/javascript"></script>
    <script type="text/javascript" src="<%=path%>/js/BoxSelect.js"></script>
    <script type="text/javascript">
    var indexNum=0,grid;
    
    $(document).ready(function(){
    	
      
    	new Toolbar({
			renderTo : 'toolbar',
			icon : '../../image/op.gif',
			border : 'both',
			items : [ {
				type : 'button',
				text : '提取出库商品',
				tip : '提取出库商品',
				useable : 'T',
				position : {
					a : '0px 0px',
					b : '0px -120px'
				},
				handler : function() {
					stock.choose();
				}
			}]
		});
    	
      grid = new Grid({
        titleTable:'titleTable',
        dataTable:'dataTable',
        widths : [120,120,120,120,120,120,15],
        height : 268
      });
      
      loadReady();
    });
    
	function addData(dataArray) {
		var table = $('#dataTable');
		for ( var i = 0, len = dataArray.length; i < len; ++i) {
			if ($('#' + dataArray[i].pId).length) {
				continue;
			}
			var htmlString = [];
			htmlString.push('<tr class="row" id="'+dataArray[i].id+'">');
			htmlString.push('<td><span>' + dataArray[i].pCode
					+ '</span></td>');
			htmlString.push('<td><span>' + dataArray[i].pName
					+ '</span></td>');
			htmlString.push('<td><span>' + dataArray[i].pStandard
					+ '</span></td>');
			htmlString.push('<td><span>' + dataArray[i].pManufacturer
					+ '</span></td>');
			htmlString.push('<td><span>' + dataArray[i].wName
					+ '</span></td>');
			//htmlString.push('<td><span>'+dataArray[i].stockBackAmounts+'</span></td>');
			htmlString
					.push('<td><span><input type="text" name="outOrderProducts['+ i +'].amounts"></span></td>');
			htmlString
					.push('<input type="hidden" name="outOrderProducts['+ i +'].product.id" value="'+dataArray[i].pId+'">');
			htmlString
					.push('<input type="hidden" name="outOrderProducts['+ i +'].warehouse.id" value="'+dataArray[i].wId+'">');
			htmlString
					.push('<td><div align="center" class="quick-button" style="background-position: -39px 0px;" onclick="delData(\''
							+ dataArray[i].id + '\')"></div></td>');
			htmlString.push('</tr>');
			table.append(htmlString.join(''));
			indexNum++;
		}
		if (grid) {
			grid.updateWidth();
		}
	}

	function delData(id) {
		$('#' + id).remove();
		indexNum--;
	}
      
      function delData(id) {
        $('#'+id).remove();
        indexNum--;
      }
   	var valid = new Validation('salesOrderOutForm',{immediate:true});
    </script>
  </body>
</html>